package com.example.webrtcrooma.webrtc;


import com.example.webrtcrooma.ChatRoomActivity;
import com.example.webrtcrooma.MainActivity;


import com.example.webrtcrooma.connection.PeerConnectionManager;
import com.example.webrtcrooma.webrtc.socket.WebRtcSocketManager;

import org.webrtc.EglBase;

public class WebRtcManager {
    private static final WebRtcManager instance = new WebRtcManager();
    private PeerConnectionManager peerConnectionManager;

    private WebRtcSocketManager webRtcSocketManager;
    String RoomId = "1100";
    public static WebRtcManager getInstance() {
        return instance;
    }
    private  WebRtcManager(){

    }

    public void connect(MainActivity activity, String roomId){
        peerConnectionManager = new PeerConnectionManager();
        webRtcSocketManager = new WebRtcSocketManager(activity, peerConnectionManager);
        webRtcSocketManager.connect("wss://8.210.234.39/wss");
    }
    public void joinRoom(ChatRoomActivity activity, EglBase eglBase){
        peerConnectionManager.initContext(activity, eglBase);
            webRtcSocketManager.joinRoom(RoomId);
    }
}
